﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using bzxxxt.admin.service;
using bzxxxt.bll;
using bzxxxt.model;

namespace bzxxxt.admin.ashx
{
    public partial class queryqrcode : System.Web.UI.Page
    {
        public List<DeadInfo> list = new List<DeadInfo>();
        protected void Page_Load(object sender, EventArgs e)
        {
            string ids = Request.Params["ids"];
            if (string.IsNullOrEmpty(ids))
            {
                Response.Write("死者不存在，请与管理员联系！");
                return;
            }
            string url = Request.Headers["host"];           
            DeadBLL bll = new DeadBLL();
            list = bll.queryDeadList(ids);
            foreach(DeadInfo d in list)
            {
                d.url = "http://" + url + "/admin/ashx/querydeadinfo.aspx?code=" + d.deadcode;
                string fileName = JsonUtil.CreateQrCode(d.url, d.deadcode);
                d.qrcodeurl = fileName;
            }
            DataList1.DataSource = list;
            DataList1.DataBind();          
        }
    }

    public class DeadInfo {
        public int deadid { get; set; }
        public string url { get; set; }
        public string deadname { get; set; }
        public string deadcode { get; set; }
        public string qrcodeurl { get; set; }    
        public string relativename { get; set; }
        public string relativetel { get; set; }
        
    }
}